import { createRouter, createWebHistory } from "vue-router";
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      component: () => import("@/views/layout/index.vue"),
      children: [
        { path: "", component: () => import("@/views/home/index.vue") },
        {
          path: "category/:id",
          component: () => import("@/views/category/index.vue"),
        },
        {
          path: "category/sub/:id",
          component: () => import("@/views/Subcategory/index.vue"),
        },
        {
          path: "detail/:id",
          component: () => import("@/views/Detail/index.vue"),
        },
        {
          path: "cartList",
          component: () => import("@/views/CartList/index.vue"),
        },
        {
          path: "checkout",
          component: () => import("@/views/Checkout/Checkout.vue"),
        },
        {
          path: "play",
          component: () => import("@/views/Play/Play.vue"),
        },
        {
          path: "paycallback",
          component: () => import("@/views/Play/PayBack.vue"),
        },
        {
          path:"member",
          component:()=>import("@/views/Member/Member.vue"),
          children:[
            {
              path:"",
              component:()=>import("@/views/Member/UserInfo.vue")
            },
            {
              path:"/member/order",
              component:()=>import("@/views/Member/UserOrder.vue")
            }
          ]
        }
      ],
    },
    {
      path: "/login",
      component: () => import("@/views/login/index.vue"),
    },
  ],
  scrollBehavior() {
    return {
      top: 0,
    };
  },
});

export default router;
